package com.zpf.service.impl;

import com.zpf.mapper.UserMapper;
import com.zpf.pojo.User;
import com.zpf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

//注解的种类
//@Repository
//@Controller
//@Service
//@Component
@Service("service1")
public class UserServiceImpl implements UserService {
//    需要被注入的用户dao全局对象
    @Autowired//自动注入
    private UserMapper userMapper;


//    从jdbc.properties文件根据key拿value值
    @Value("${jdbc.url}")
    private String url;

    @Value("${jdbc.username}")
    private String username;

    @Override
    public List<User> findAll() {
        System.out.println("====url:======="+url);
        System.out.println("====username:======="+username);
        List<User> list = userMapper.findUserAll();
        return list;
    }
}
